import type { RouteRecordRaw } from 'vue-router';

import { DEFAULT_HOME_PATH } from '@vben/constants';

import { AuthPageLayout } from '#/layouts';
import { $t } from '#/locales';
import Login from '#/views/_core/authentication/login.vue';

/** 全局404页面 */
const fallbackNotFoundRoute: RouteRecordRaw = {
  component: () => import('#/views/_core/fallback/not-found.vue'),
  meta: {
    hideInBreadcrumb: true,
    hideInMenu: true,
    hideInTab: true,
    title: '404',
  },
  name: 'FallbackNotFound',
  path: '/:path(.*)*',
};

/** 基本路由，这些路由是必须存在的 */
const coreRoutes: RouteRecordRaw[] = [
  {
    meta: {
      title: 'Root',
    },
    name: 'Root',
    path: '/',
    redirect: DEFAULT_HOME_PATH,
    children: [
      {
        name: 'BindDlyDy',
        path: 'bind-dly-dy',
        component: () => import('#/views/_core/authentication/bind-dly-dy.vue'),
        meta: {
          title: '授权',
        },
      },
      {
        name: 'InDoudianGet1688',
        path: 'in-doudian-get-1688',
        component: () => import('#/views/indoudian/get1688/index.vue'),
        meta: {
          title: '铺货到抖店',
        },
      },
      {
        meta: {
          title: '下单授权',
          hideInMenu: true,
          hideInTab: true,
          hideInBreadcrumb: true,
        },
        name: 'shogunYPY',
        path: '/shop-auth/shop-auth-home-ypy',
        component: () => import('#/views/shopAuth/homeypy.vue'),
      },
    ],
  },

  {
    meta: {
      title: 'TokenLogin',
    },
    name: 'TokenLogin',
    path: '/',
    redirect: DEFAULT_HOME_PATH,
    children: [
      {
        name: 'JwtLogin',
        path: 'jwtLogin',
        component: () => import('#/views/jwtLogin.vue'),
        meta: {
          title: 'token登录',
        },
      },
    ],
  },

  {
    component: AuthPageLayout,
    meta: {
      hideInTab: true,
      title: 'Authentication',
    },
    name: 'Authentication',
    path: '/auth',
    children: [
      {
        name: 'Login',
        path: 'login',
        component: Login,
        meta: {
          title: $t('page.auth.login'),
        },
      },
      {
        name: 'CodeLogin',
        path: 'code-login',
        component: () => import('#/views/_core/authentication/code-login.vue'),
        meta: {
          title: $t('page.auth.codeLogin'),
        },
      },
      {
        name: 'QrCodeLogin',
        path: 'qrcode-login',
        component: () =>
          import('#/views/_core/authentication/qrcode-login.vue'),
        meta: {
          title: $t('page.auth.qrcodeLogin'),
        },
      },
      {
        name: 'ForgetPassword',
        path: 'forget-password',
        component: () =>
          import('#/views/_core/authentication/forget-password.vue'),
        meta: {
          title: $t('page.auth.forgetPassword'),
        },
      },
      {
        name: 'Register',
        path: 'register',
        component: () => import('#/views/_core/authentication/register.vue'),
        meta: {
          title: $t('page.auth.register'),
        },
      },
    ],
  },
];

export { coreRoutes, fallbackNotFoundRoute };
